// 加载层
var loadindex = layer.load(2, {
    shade: [0.8, "#fff"]
})
$.get('../php/list.php', res => {
    console.log(res)
    //加载数据
    var {
        meta: {
            status,
            msg
        },
        data
    } = res;

    if (status === 1) {
        let str = '';
        for (let i = 0; i < 10; i++) {
            str += `
            <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">
                <div class="thumbnail">
                    <img src="${data[i].imgpath}" alt="...">
                    <div class="caption">
                        <h3>¥${data[i].price}</h3>
                        <p>${data[i].info}</p>
                        <a href="../page/detail.html?id=${data[i].id}">${data[i].shop}</a>
                    </div>
                </div>
            </div>
            `
        }
        $('.goods>.row').html(str);
    };

    if (status === 1) {
        let str = '';
        for (let i = 10; i < 20; i++) {
            str += `
            <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">
                <div class="thumbnail">
                    <img src="${data[i].imgpath}" alt="...">
                    <div class="caption">
                        <h3>¥${data[i].price}</h3>
                        <p>${data[i].info}</p>
                        <a href="#">${data[i].shop}</a>
                    </div>
                </div>
            </div>
            `
        }
        $('.goods1>.row').html(str);
    }

    layer.close(loadindex);
}, 'json')